Skip to content

Enable poweroff feature on NXP MCXA and MCXN series MCUs. #92844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ZhaoxiangJin
Copy link
Contributor

@ZhaoxiangJin ZhaoxiangJin commented Jul 8, 2025

This PR enabled poweroff feature for NXP MCXA and MCXN series MCUs.

@ZhaoxiangJin ZhaoxiangJin force-pushed the enable-poweroff-on-mcx branch 3 times, most recently from f05d9c5 to 52be524 Compare July 8, 2025 14:21
@ZhaoxiangJin ZhaoxiangJin marked this pull request as ready for review July 8, 2025 14:21
@ZhaoxiangJin ZhaoxiangJin changed the title Enable poweroff on mcx Enable poweroff feature on NXP MCXA series MCUs. Jul 8, 2025
@ZhaoxiangJin ZhaoxiangJin force-pushed the enable-poweroff-on-mcx branch from 52be524 to a99e520 Compare July 8, 2025 14:46
dleach02
dleach02 previously approved these changes Jul 9, 2025
@butok
Copy link
Contributor

butok commented Jul 14, 2025

samples/boards/nxp/mcx/mcxa/poweroff/src/main.c contains the common Zephyr API code.

Can we avoid creating the NXP board-specific samples in the samples/boards/nxp/mcx/mcxa/poweroff/ and instead place them in a common location, such as samples/subsys/poweroff or another common sample directory?

Pulling MCUX SDK cmc, vbat, wuu driver to Zephyr build tree.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit enables MCXN236, MCXN947 LPUART pin internal
pullup resistor. For MCXN947 and MCXN236, during LPUAR
initialization, the RX pin is pulled down internally
and STAT [RAF] is set to one. In this state, attempting
to enter low power mode will trigger LPACK reset and
therefore cannot truly enter low power mode. The correct
setting should be to enable LPUART pin internal pullup resistor.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit introduced the following changes:
1. Selected kconfig option 'HAS_POWEROFF' for NXP
   MCXA series.
2. Added power.c for NXP MCXA series, in this file,
   we currently implemented 'z_sys_poweroff()' function.
3. For the MCXA series, after waking up from the deep
   power down mode, the reset handler will be executed,
   and we need to release the I/O pads and certain peripheral
   devices to normal operating mode in 'soc_reset_hook'.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit introduced the following changes:
1. Selected kconfig option 'HAS_POWEROFF' for NXP
   MCXN series.
2. Added power.c for NXP MCXN series, in this file,
   we currently implemented 'z_sys_poweroff()' function.
3. For the MCXN series, after waking up from the deep
   power down mode, the reset handler will be executed,
   and we need to release the I/O pads and certain peripheral
   devices to normal operating mode in 'soc_reset_hook'.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Enabled FRO16k for LPTMR when LPTMR clock source
is set to 0x1.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Enabled FRO16k for LPTMR when LPTMR clock source
is set to 0x1.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit enabled poweroff case for NXP MCXA and
MCXN series MCUs.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
@dleach02
Copy link
Member

@butok it does make sense. The yaml could be conditioned on the HAS_POWEROFF.

@hakehuang, can you provide guidance?

@ZhaoxiangJin ZhaoxiangJin force-pushed the enable-poweroff-on-mcx branch from a99e520 to fce2e01 Compare July 15, 2025 01:48
@ZhaoxiangJin ZhaoxiangJin changed the title Enable poweroff feature on NXP MCXA series MCUs. Enable poweroff feature on NXP MCXA and MCXN series MCUs. Jul 15, 2025
@ZhaoxiangJin
Copy link
Contributor Author

@butok it does make sense. The yaml could be conditioned on the HAS_POWEROFF.

@hakehuang, can you provide guidance?

How about create a NXP MCUs general poweroff demo under samples/boards/nxp/poweroff?

Copy link

@hakehuang
Copy link
Contributor

@hakehuang, can you provide guidance?

agree with @butok, @ZhaoxiangJin I would suggest to follow the samples\boards\nxp\mimxrt595_evk\system_off and create a for poweroff.

@butok
Copy link
Contributor

butok commented Jul 15, 2025

@butok it does make sense. The yaml could be conditioned on the HAS_POWEROFF.
@hakehuang, can you provide guidance?

How about create a NXP MCUs general poweroff demo under samples/boards/nxp/poweroff?

It's possible to create a common demo. Platform-specific peculiarities should be addressed through board-specific configurations/overlays.

In my opinion, vendor-specific samples break the main Zephyr philosophy, and they should be an exception (probably, approved by TSC).

@hakehuang
Copy link
Contributor

In my opinion, vendor-specific samples break the main Zephyr philosophy, and they should be an exception (probably, approved by TSC).

@butok , you can take a look at the tests/subsys/pm which is much more well organized, and I am working on a power shield to fully support this. As to NPI enablement, maybe it is ok to add a board vendor demo first for now, we need catchup step by step.

@ZhaoxiangJin
Copy link
Contributor Author

@butok it does make sense. The yaml could be conditioned on the HAS_POWEROFF.
@hakehuang, can you provide guidance?

How about create a NXP MCUs general poweroff demo under samples/boards/nxp/poweroff?

It's possible to create a common demo. Platform-specific peculiarities should be addressed through board-specific configurations/overlays.

In my opinion, vendor-specific samples break the main Zephyr philosophy, and they should be an exception (probably, approved by TSC).

I am creating a general poweroff example for NXP MCUs, i will also migrate already exist mimxrt595_evk and mimxrt1060_evk system_off example to the new poweroff example.

@ZhaoxiangJin ZhaoxiangJin marked this pull request as draft July 15, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants